<!DOCTYPE html>
<html lang="ch">
<head>
    <meta charset="UTF-8">
<meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="author" content="Vico">





<title>JVM虚拟机 | Vico的个人博客</title>



    <link rel="icon" href="/favicon.ico">




    <!-- stylesheets list from _config.yml -->
    
    <link rel="stylesheet" href="/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
    <script src="/js/script.js"></script>
    
    <script src="/js/tocbot.min.js"></script>
    



    
    
        
    


<meta name="generator" content="Hexo 4.2.0"></head>
<body>
    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/">首页</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/archives">时间轴</a>
                
                    <a class="menu-item" href="/category">分类</a>
                
                    <a class="menu-item" href="/tag">标签</a>
                
                    <a class="menu-item" href="/about">关于</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>
        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/">首页</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/archives">时间轴</a>
                
                    <a class="menu-item" href="/category">分类</a>
                
                    <a class="menu-item" href="/tag">标签</a>
                
                    <a class="menu-item" href="/about">关于</a>
                
            </div>
        </div>
    </nav>

</header>
<script>
    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
        <div class="main">
            <div class="container">
    
    
        <div class="post-toc">
    <div class="tocbot-list">
    </div>
    <div class="tocbot-list-menu">
        <a class="tocbot-toc-expand" onclick="expand_toc()">展开全部</a>
        <a onclick="go_top()">回到顶部</a>
        <a onclick="go_bottom()">去底部</a>
    </div>
</div>

<script>
    document.ready(
        function () {
            tocbot.init({
                tocSelector: '.tocbot-list',
                contentSelector: '.post-content',
                headingSelector: 'h1, h2, h3, h4, h5',
                collapseDepth: 1,
                orderedList: false,
                scrollSmooth: true,
            })
        }
    )

    function expand_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 6,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "collapse_toc()");
        b.innerHTML = "全部收缩"
    }

    function collapse_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 1,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "expand_toc()");
        b.innerHTML = "展开全部"
    }

    function go_top() {
        window.scrollTo(0, 0);
    }

    function go_bottom() {
        window.scrollTo(0, document.body.scrollHeight);
    }

</script>
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">JVM虚拟机</h1>
            
                <div class="post-meta">
                    
                        作者: <a itemprop="author" rel="author" href="/">Vico</a>
                    

                    
                        <span class="post-time">
                        日期: <a href="#">April 8, 2020&nbsp;&nbsp;20:52:12</a>
                        </span>
                    
                    
                        <span class="post-category">
                    分类:
                            
                                <a href="/categories/%E6%89%8B%E8%AE%B0/">手记</a>
                            
                        </span>
                    
                </div>
            
        </header>

        <div class="post-content">
            <h2 id="JVM介绍"><a href="#JVM介绍" class="headerlink" title="JVM介绍"></a>JVM介绍</h2><p>JVM其实就是Java Virtual Machine【java虚拟机】，java之所以跨平台其实因为我们<strong><em>通过javac将java文件编译为class文件（字节码文件），然后调用JVM使字节码文件转换为机器可以识别的机器码，机器就可以调用啦</em></strong></p>
<h3 id="1-JDK、JRE、JVM的区别"><a href="#1-JDK、JRE、JVM的区别" class="headerlink" title="1. JDK、JRE、JVM的区别"></a>1. JDK、JRE、JVM的区别</h3><p><img src="../pictures/JVM%E3%80%81JRE%E3%80%81JDK%E7%9A%84%E5%85%B3%E7%B3%BB.jpg" alt="JVM、JRE、JDK的关系"></p>
<p>大家可以清楚得看出来他们之间的关系了吧，当然我们从java官网下载的JDK中其实有两个JVM虚拟机，在此不在讨论，有兴趣的小伙伴可以打开下载的JDK，会发现里面有一个单独的JRE包</p>
<h3 id="2-JVM的构成"><a href="#2-JVM的构成" class="headerlink" title="2. JVM的构成"></a>2. JVM的构成</h3><p>JVM的构成包含三块，包含类加载系统、运行时数据区、执行引擎，即：</p>
<p>1.类加载系统</p>
<p>​    加载硬盘文件、class文件、类路径、系统参数等磁盘上的文件到内存中，供给JVM运行时使用</p>
<p>2.运行时数据区</p>
<p>​    <strong><em>JVM最重要的部分</em></strong>，包含堆、方法区、虚拟机栈、本地方法栈、程序计数器。也就是我们java程序在内存中的最基本结构</p>
<p>3.执行引擎</p>
<p>​    主要负责将运行时数据区的数据转换成机器码，然后交给CPU进行计算机执行</p>
<p><img src="../pictures/JVM%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%BB%93%E6%9E%84.jpg" alt="JVM、JRE、JDK的关系"></p>

        </div>

        
            <section class="post-copyright">
                
                    <p class="copyright-item">
                        <span>作者：</span>
                        <span>Vico</span>
                    </p>
                
                
                    <p class="copyright-item">
                        <span>链接：</span>
                        <span><a href="https://vico-cuiym.github.io/2020/04/08/JVM%E8%99%9A%E6%8B%9F%E6%9C%BA/">https://vico-cuiym.github.io/2020/04/08/JVM%E8%99%9A%E6%8B%9F%E6%9C%BA/</a></span>
                    </p>
                
                
                    <p class="copyright-item">
                        <span>执照：</span>
                        <span>Copyright (c) 2019 <a href="http://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener">CC-BY-NC-4.0</a> LICENSE</span>
                    </p>
                
                
                     <p class="copyright-item">
                         <span>脚注：</span>
                         <span>你相信 <strong>命运</strong> 吗?</span>
                     </p>
                

            </section>
        
        <section class="post-tags">
            <div>
                <span>标签:</span>
                <span class="tag">
                    
                    
                        <a href="/tags/java/"># java</a>
                    
                        
                </span>
            </div>
            <div>
                <a href="javascript:window.history.back();">上一页</a>
                <span>· </span>
                <a href="/">首页</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/2020/04/08/9%E4%B8%AA%E5%B0%8F%E6%8A%80%E5%B7%A7%E8%AE%A9%E4%BD%A0%E7%9A%84%20if%20else%E7%9C%8B%E8%B5%B7%E6%9D%A5%E6%9B%B4%E4%BC%98%E9%9B%85%EF%BC%81/">9个技巧让你的 if else看起来更牛逼！</a>
            
            
            <a class="next" rel="next" href="/2020/03/09/BIO%20NOI%20AIO%E7%9A%84%E5%8C%BA%E5%88%AB/">BIO NIO AIO的区别</a>
            
        </section>


    </article>
</div>

        </div>
        <footer id="footer" class="footer">
    <div class="copyright">
        <span>© Vico的个人博客 | 博客风格技术支持 <a href="https://hexo.io" target="_blank">Hexo</a> & <a href="https://github.com/Siricee/hexo-theme-Chic" target="_blank">Chic</a></span>
    </div>
</footer>

    </div>
</body>
</html>
